Skip to content

Commit

Permalink
Merge branch 'master' into increase-test-cov-uint256
Browse files Browse the repository at this point in the history
  • Loading branch information
thehowl authored Oct 23, 2024
2 parents 4003ac4 + 247f2c6 commit d797500
Show file tree
Hide file tree
Showing 186 changed files with 5,227 additions and 2,789 deletions.
5 changes: 5 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,8 @@ flag_management:
- type: patch
target: auto # Let's decrease this later.
threshold: 10

ignore:
- "gnovm/stdlibs/generated.go"
- "gnovm/tests/stdlibs/generated.go"
- "**/*.pb.go"
1 change: 0 additions & 1 deletion .github/workflows/misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
- genproto
- genstd
- goscan
- logos
- loop
name: Run Main
uses: ./.github/workflows/main_template.yml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nightlies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
go-version: "1.22.x"
cache: true

- uses: sigstore/cosign-installer@v3.6.0
- uses: anchore/sbom-action/[email protected].2
- uses: sigstore/cosign-installer@v3.7.0
- uses: anchore/sbom-action/[email protected].5

- uses: docker/login-action@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/releaser-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
go-version: "1.22.x"
cache: true

- uses: sigstore/cosign-installer@v3.6.0
- uses: anchore/sbom-action/[email protected].2
- uses: sigstore/cosign-installer@v3.7.0
- uses: anchore/sbom-action/[email protected].5

- uses: docker/login-action@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
go-version: "1.22.x"
cache: true

- uses: sigstore/cosign-installer@v3.6.0
- uses: anchore/sbom-action/[email protected].2
- uses: sigstore/cosign-installer@v3.7.0
- uses: anchore/sbom-action/[email protected].5

- uses: docker/login-action@v3
with:
Expand Down
7 changes: 3 additions & 4 deletions contribs/gnodev/pkg/dev/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,8 @@ func newNodeConfig(tmc *tmcfg.Config, chainid string, appstate gnoland.GnoGenesi
}

return &gnoland.InMemoryNodeConfig{
PrivValidator: pv,
TMConfig: tmc,
Genesis: genesis,
GenesisMaxVMCycles: 100_000_000,
PrivValidator: pv,
TMConfig: tmc,
Genesis: genesis,
}
}
2 changes: 1 addition & 1 deletion examples/gno.land/p/demo/gnorkle/gnorkle/instance.gno
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func (i *Instance) GetFeedDefinitions(forAddress string) (string, error) {

first = false
buf.Write(taskBytes)
return true
return false
})

if err != nil {
Expand Down
7 changes: 6 additions & 1 deletion examples/gno.land/r/gnoland/ghverify/contract.gno
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ func RequestVerification(githubHandle string) {
); err != nil {
panic(err)
}
std.Emit(
"verification_requested",
"from", gnoAddress,
"handle", githubHandle,
)
}

// GnorkleEntrypoint is the entrypoint to the gnorkle oracle handler.
Expand Down Expand Up @@ -139,7 +144,7 @@ func Render(_ string) string {
result += `"` + handle + `": "` + address.(string) + `"`
appendComma = true

return true
return false
})

return result + "}"
Expand Down
33 changes: 20 additions & 13 deletions examples/gno.land/r/gnoland/ghverify/contract_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import (

func TestVerificationLifecycle(t *testing.T) {
defaultAddress := std.GetOrigCaller()
userAddress := std.Address(testutils.TestAddress("user"))
user1Address := std.Address(testutils.TestAddress("user 1"))
user2Address := std.Address(testutils.TestAddress("user 2"))

// Verify request returns no feeds.
result := GnorkleEntrypoint("request")
Expand All @@ -18,7 +19,7 @@ func TestVerificationLifecycle(t *testing.T) {
}

// Make a verification request with the created user.
std.TestSetOrigCaller(userAddress)
std.TestSetOrigCaller(user1Address)
RequestVerification("deelawn")

// A subsequent request from the same address should panic because there is
Expand All @@ -42,42 +43,48 @@ func TestVerificationLifecycle(t *testing.T) {
t.Fatalf("expected empty request result, got %s", result)
}

// Make a verification request with the created user.
std.TestSetOrigCaller(user2Address)
RequestVerification("omarsy")

// Set the caller back to the whitelisted user and verify that the feed data
// returned matches what should have been created by the `RequestVerification`
// invocation.
std.TestSetOrigCaller(defaultAddress)
result = GnorkleEntrypoint("request")
expResult := `[{"id":"` + string(userAddress) + `","type":"0","value_type":"string","tasks":[{"gno_address":"` +
string(userAddress) + `","github_handle":"deelawn"}]}]`
expResult := `[{"id":"` + string(user1Address) + `","type":"0","value_type":"string","tasks":[{"gno_address":"` +
string(user1Address) + `","github_handle":"deelawn"}]},` +
`{"id":"` + string(user2Address) + `","type":"0","value_type":"string","tasks":[{"gno_address":"` +
string(user2Address) + `","github_handle":"omarsy"}]}]`
if result != expResult {
t.Fatalf("expected request result %s, got %s", expResult, result)
}

// Try to trigger feed ingestion from the non-authorized user.
std.TestSetOrigCaller(userAddress)
std.TestSetOrigCaller(user1Address)
func() {
defer func() {
if r := recover(); r != nil {
errMsg = r.(error).Error()
}
}()
GnorkleEntrypoint("ingest," + string(userAddress) + ",OK")
GnorkleEntrypoint("ingest," + string(user1Address) + ",OK")
}()
if errMsg != "caller not whitelisted" {
t.Fatalf("expected caller not whitelisted, got %s", errMsg)
}

// Set the caller back to the whitelisted user and transfer contract ownership.
std.TestSetOrigCaller(defaultAddress)
SetOwner(userAddress)
SetOwner(defaultAddress)

// Now trigger the feed ingestion from the user and new owner and only whitelisted address.
std.TestSetOrigCaller(userAddress)
GnorkleEntrypoint("ingest," + string(userAddress) + ",OK")
GnorkleEntrypoint("ingest," + string(user1Address) + ",OK")
GnorkleEntrypoint("ingest," + string(user2Address) + ",OK")

// Verify the ingestion autocommitted the value and triggered the post handler.
data := Render("")
expResult = `{"deelawn": "` + string(userAddress) + `"}`
expResult = `{"deelawn": "` + string(user1Address) + `","omarsy": "` + string(user2Address) + `"}`
if data != expResult {
t.Fatalf("expected render data %s, got %s", expResult, data)
}
Expand All @@ -89,10 +96,10 @@ func TestVerificationLifecycle(t *testing.T) {
}

// Check that the accessor functions are working as expected.
if handle := GetHandleByAddress(string(userAddress)); handle != "deelawn" {
if handle := GetHandleByAddress(string(user1Address)); handle != "deelawn" {
t.Fatalf("expected deelawn, got %s", handle)
}
if address := GetAddressByHandle("deelawn"); address != string(userAddress) {
t.Fatalf("expected %s, got %s", string(userAddress), address)
if address := GetAddressByHandle("deelawn"); address != string(user1Address) {
t.Fatalf("expected %s, got %s", string(user1Address), address)
}
}
2 changes: 1 addition & 1 deletion examples/gno.land/r/gnoland/pages/page_contribute.gno
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Don't fear your work being "stolen": if a submission is the result of multiple p
- If you, for instance, cannot complete the entirety of the task or, as a non-developer, can only contribute a part of the specification/implementation, you may still be awarded a bounty for your input in the contribution.
- If Alice makes a PR that aside from implementing what's required, also undertakes creating useful tools among the way, she may qualify for an "outstanding contribution"; and may be awarded up to 25% more of the original bounty's value. Or she may also ask if the team would be willing to offer a different bounty for the implementation of the tools.
Participants in the gno.land Bounty Program must meet the legal Terms and Conditions referenced [here](https://docs.google.com/document/d/1aXrZ6japdAykB5FLmHCCeBZTo-2tbZQHSQi79ITaTK0).
Participants in the gno.land Bounty Program must meet the legal Terms and Conditions referenced [here](https://docs.google.com/document/d/e/2PACX-1vSUF-JwIXGscrNsc5QBD7Pa6i83mXUGogAEIf1wkeb_w42UgL3Lj6jFKMlNTdwEMUnhsLkjRlhe25K4/pub).
### Bounty sizes
Expand Down
9 changes: 9 additions & 0 deletions examples/gno.land/r/stefann/home/gno.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module gno.land/r/stefann/home

require (
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/ownable v0.0.0-latest
gno.land/p/demo/testutils v0.0.0-latest
gno.land/p/demo/ufmt v0.0.0-latest
gno.land/r/stefann/registry v0.0.0-latest
)
Loading

0 comments on commit d797500

Please sign in to comment.