Skip to content

Commit

Permalink
Merge branch 'devx/feature/boardsv2' into feat/realm-upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
jeronimoalbi committed Jan 16, 2025
2 parents 83d0b93 + adaafd7 commit a247dc5
Show file tree
Hide file tree
Showing 249 changed files with 10,644 additions and 8,636 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/releaser-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
cache: true

- uses: sigstore/[email protected]
- uses: anchore/sbom-action/[email protected].8
- uses: anchore/sbom-action/[email protected].9

- uses: docker/login-action@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/releaser-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
cache: true

- uses: sigstore/[email protected]
- uses: anchore/sbom-action/[email protected].8
- uses: anchore/sbom-action/[email protected].9

- uses: docker/login-action@v3
with:
Expand Down
22 changes: 15 additions & 7 deletions contribs/github-bot/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,22 @@ func Config(gh *client.GitHub) ([]AutomaticCheck, []ManualCheck) {
{
Description: "Changes to 'docs' folder must be reviewed/authored by at least one devrel and one tech-staff",
If: c.FileChanged(gh, "^docs/"),
Then: r.Or(
r.And(
r.AuthorInTeam(gh, "devrels"),
Then: r.And(
r.Or(
r.AuthorInTeam(gh, "tech-staff"),
r.ReviewByTeamMembers(gh, "tech-staff", 1),
),
r.And(
r.AuthorInTeam(gh, "tech-staff"),
r.Or(
r.AuthorInTeam(gh, "devrels"),
r.ReviewByTeamMembers(gh, "devrels", 1),
),
),
},
{
Description: "Must not contain the \"don't merge\" label",
If: c.Label("don't merge"),
Then: r.Never(),
},
}

manual := []ManualCheck{
Expand All @@ -59,8 +64,11 @@ func Config(gh *client.GitHub) ([]AutomaticCheck, []ManualCheck) {
},
{
Description: "The pull request description provides enough details",
If: c.Not(c.AuthorInTeam(gh, "core-contributors")),
Teams: Teams{"core-contributors"},
If: c.And(
c.Not(c.AuthorInTeam(gh, "core-contributors")),
c.Not(c.Author("dependabot[bot]")),
),
Teams: Teams{"core-contributors"},
},
{
Description: "Determine if infra needs to be updated before merging",
Expand Down
2 changes: 1 addition & 1 deletion contribs/gnodev/pkg/dev/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ func testingCallRealm(t *testing.T, node *Node, msgs ...vm.MsgCall) (*core_types

txcfg := gnoclient.BaseTxCfg{
GasFee: ugnot.ValueString(1000000), // Gas fee
GasWanted: 2_000_000, // Gas wanted
GasWanted: 3_000_000, // Gas wanted
}

// Set Caller in the msgs
Expand Down
1 change: 0 additions & 1 deletion contribs/gnogenesis/internal/txs/txs_add_packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (

const (
defaultAccount_Name = "test1"
defaultAccount_Address = "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5"
defaultAccount_Seed = "source bonus chronic canvas draft south burst lottery vacant surface solve popular case indicate oppose farm nothing bullet exhibit title speed wink action roast"
defaultAccount_publicKey = "gpub1pgfj7ard9eg82cjtv4u4xetrwqer2dntxyfzxz3pq0skzdkmzu0r9h6gny6eg8c9dc303xrrudee6z4he4y7cs5rnjwmyf40yaj"
)
Expand Down
2 changes: 1 addition & 1 deletion contribs/gnomd/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ require (
github.com/mattn/go-isatty v0.0.11 // indirect
github.com/mattn/go-runewidth v0.0.12 // indirect
github.com/rivo/uniseg v0.1.0 // indirect
golang.org/x/image v0.0.0-20191206065243-da761ea9ff43 // indirect
golang.org/x/image v0.18.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sys v0.18.0 // indirect
)
3 changes: 2 additions & 1 deletion contribs/gnomd/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion contribs/gnomigrate/internal/txs/txs.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func processFile(ctx context.Context, io commands.IO, source, destination string
continue
}

if _, err = outputFile.WriteString(fmt.Sprintf("%s\n", string(marshaledData))); err != nil {
if _, err = fmt.Fprintf(outputFile, "%s\n", marshaledData); err != nil {
io.ErrPrintfln("unable to save to output file, %s", err)
}
}
Expand Down
16 changes: 16 additions & 0 deletions examples/gno.land/p/demo/avl/list/list.gno
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ import (
"gno.land/p/demo/seqid"
)

// IList defines the interface for list operations
type IList interface {
Len() int
Append(values ...interface{})
Get(index int) interface{}
Set(index int, value interface{}) bool
Delete(index int) (interface{}, bool)
Slice(startIndex, endIndex int) []interface{}
ForEach(fn func(index int, value interface{}) bool)
Clone() *List
DeleteRange(startIndex, endIndex int) int
}

// Verify List implements IList interface
var _ IList = (*List)(nil)

// List represents an ordered sequence of items backed by an AVL tree
type List struct {
tree avl.Tree
Expand Down
64 changes: 64 additions & 0 deletions examples/gno.land/p/demo/avl/list/list_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package list

import (
"testing"

"gno.land/p/demo/ufmt"
)

func TestList_Basic(t *testing.T) {
Expand Down Expand Up @@ -395,6 +397,68 @@ func TestList_IndexConsistency(t *testing.T) {
}
}

func TestList_RecursiveSafety(t *testing.T) {
// Create a new list
l := &List{}

// Add some initial values
l.Append("id1")
l.Append("id2")
l.Append("id3")

// Test deep list traversal
found := false
l.ForEach(func(i int, v interface{}) bool {
if str, ok := v.(string); ok {
if str == "id2" {
found = true
return true // stop iteration
}
}
return false // continue iteration
})

if !found {
t.Error("Failed to find expected value in list")
}

short := testing.Short()

// Test recursive safety by performing multiple operations
for i := 0; i < 1000; i++ {
// Add new value
l.Append(ufmt.Sprintf("id%d", i+4))

if !short {
// Search for a value
var lastFound bool
l.ForEach(func(j int, v interface{}) bool {
if str, ok := v.(string); ok {
if str == ufmt.Sprintf("id%d", i+3) {
lastFound = true
return true
}
}
return false
})

if !lastFound {
t.Errorf("Failed to find value id%d after insertion", i+3)
}
}
}

// Verify final length
expectedLen := 1003 // 3 initial + 1000 added
if l.Len() != expectedLen {
t.Errorf("Expected length %d, got %d", expectedLen, l.Len())
}

if short {
t.Skip("skipping extended recursive safety test in short mode")
}
}

// Helper function to compare slices
func sliceEqual(a, b []interface{}) bool {
if len(a) != len(b) {
Expand Down
1 change: 1 addition & 0 deletions examples/gno.land/p/demo/avl/rolist/gno.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module gno.land/p/demo/avl/rolist
119 changes: 119 additions & 0 deletions examples/gno.land/p/demo/avl/rolist/rolist.gno
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
// Package rolist provides a read-only wrapper for list.List with safe value transformation.
//
// It is useful when you want to expose a read-only view of a list while ensuring that
// the sensitive data cannot be modified.
//
// Example:
//
// // Define a user structure with sensitive data
// type User struct {
// Name string
// Balance int
// Internal string // sensitive field
// }
//
// // Create and populate the original list
// privateList := list.New()
// privateList.Append(&User{
// Name: "Alice",
// Balance: 100,
// Internal: "sensitive",
// })
//
// // Create a safe transformation function that copies the struct
// // while excluding sensitive data
// makeEntrySafeFn := func(v interface{}) interface{} {
// u := v.(*User)
// return &User{
// Name: u.Name,
// Balance: u.Balance,
// Internal: "", // omit sensitive data
// }
// }
//
// // Create a read-only view of the list
// publicList := rolist.Wrap(list, makeEntrySafeFn)
//
// // Safely access the data
// value := publicList.Get(0)
// user := value.(*User)
// // user.Name == "Alice"
// // user.Balance == 100
// // user.Internal == "" (sensitive data is filtered)
package rolist

import (
"gno.land/p/demo/avl/list"
)

// IReadOnlyList defines the read-only operations available on a list.
type IReadOnlyList interface {
Len() int
Get(index int) interface{}
Slice(startIndex, endIndex int) []interface{}
ForEach(fn func(index int, value interface{}) bool)
}

// ReadOnlyList wraps a list.List and provides read-only access.
type ReadOnlyList struct {
list *list.List
makeEntrySafeFn func(interface{}) interface{}
}

// Verify interface implementations
var _ IReadOnlyList = (*ReadOnlyList)(nil)
var _ IReadOnlyList = (interface{ list.IList })(nil) // is subset of list.IList

// Wrap creates a new ReadOnlyList from an existing list.List and a safety transformation function.
// If makeEntrySafeFn is nil, values will be returned as-is without transformation.
func Wrap(list *list.List, makeEntrySafeFn func(interface{}) interface{}) *ReadOnlyList {
return &ReadOnlyList{
list: list,
makeEntrySafeFn: makeEntrySafeFn,
}
}

// getSafeValue applies the makeEntrySafeFn if it exists, otherwise returns the original value
func (rol *ReadOnlyList) getSafeValue(value interface{}) interface{} {
if rol.makeEntrySafeFn == nil {
return value
}
return rol.makeEntrySafeFn(value)
}

// Len returns the number of elements in the list.
func (rol *ReadOnlyList) Len() int {
return rol.list.Len()
}

// Get returns the value at the specified index, converted to a safe format.
// Returns nil if index is out of bounds.
func (rol *ReadOnlyList) Get(index int) interface{} {
value := rol.list.Get(index)
if value == nil {
return nil
}
return rol.getSafeValue(value)
}

// Slice returns a slice of values from startIndex (inclusive) to endIndex (exclusive),
// with all values converted to a safe format.
func (rol *ReadOnlyList) Slice(startIndex, endIndex int) []interface{} {
values := rol.list.Slice(startIndex, endIndex)
if values == nil {
return nil
}

result := make([]interface{}, len(values))
for i, v := range values {
result[i] = rol.getSafeValue(v)
}
return result
}

// ForEach iterates through all elements in the list, providing safe versions of the values.
func (rol *ReadOnlyList) ForEach(fn func(index int, value interface{}) bool) {
rol.list.ForEach(func(index int, value interface{}) bool {
return fn(index, rol.getSafeValue(value))
})
}
Loading

0 comments on commit a247dc5

Please sign in to comment.