Skip to content

Commit

Permalink
Merge pull request onflow#227 from onflow/auto-update-onflow-cadence-…
Browse files Browse the repository at this point in the history
…v1.0.0-preview.25
  • Loading branch information
turbolent authored May 2, 2024
2 parents f948f23 + ceaa21e commit a969fbb
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 223 deletions.
11 changes: 1 addition & 10 deletions bootstrap/create-multi-key-account.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,7 @@ func eventsFromTx(tx *flow.TransactionResult) events {
}

func newEvent(event flow.Event) flowEvent {
var names []string

for _, eventType := range event.Value.EventType.Fields {
names = append(names, eventType.Identifier)
}
values := make(map[string]cadence.Value)
for id, field := range event.Value.Fields {
values[names[id]] = field
}

values := cadence.FieldsMappedByName(event.Value)
return flowEvent{
Type: event.Type,
Values: values,
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module github.com/onflow/flow-evm-gateway

go 1.21
go 1.20

require (
github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593
github.com/goccy/go-json v0.10.2
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/onflow/cadence v1.0.0-preview.23
github.com/onflow/flow-go v0.34.0-crescendo-preview.17
github.com/onflow/flow-go-sdk v1.0.0-preview.22
github.com/onflow/cadence v1.0.0-preview.25
github.com/onflow/flow-go v0.34.0-crescendo-preview.18
github.com/onflow/flow-go-sdk v1.0.0-preview.25
github.com/onflow/go-ethereum v1.13.4
github.com/rs/cors v1.8.0
github.com/rs/zerolog v1.31.0
Expand Down Expand Up @@ -74,7 +74,7 @@ require (
github.com/huin/goupnp v1.3.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/ipfs/bbloom v0.0.4 // indirect
github.com/ipfs/boxo v0.19.0 // indirect
github.com/ipfs/boxo v0.17.1-0.20240131173518-89bceff34bf1 // indirect
github.com/ipfs/go-block-format v0.2.0 // indirect
github.com/ipfs/go-cid v0.4.1 // indirect
github.com/ipfs/go-datastore v0.6.0 // indirect
Expand Down Expand Up @@ -111,7 +111,7 @@ require (
github.com/multiformats/go-multistream v0.5.0 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/onflow/atree v0.6.1-0.20240416233652-f4568c0c03df // indirect
github.com/onflow/atree v0.7.0-rc.1 // indirect
github.com/onflow/crypto v0.25.1 // indirect
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240429192223-e696a8e439b5 // indirect
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240429192223-e696a8e439b5 // indirect
Expand Down
105 changes: 10 additions & 95 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion models/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func decodeBlock(event cadence.Event) (*types.Block, error) {

hashes := make([]common.Hash, len(payload.TransactionHashes))
for i, h := range payload.TransactionHashes {
hashes[i] = common.HexToHash(h.ToGoValue().(string))
hashes[i] = common.HexToHash(string(h))
}

return &types.Block{
Expand Down
3 changes: 1 addition & 2 deletions models/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import (

func TestCadenceEvents_Block(t *testing.T) {

v, _ := cadence.NewString("invalid")
invalid, _ := cadence.NewValue(v)
invalid := cadence.String("invalid")

b0, e0, err := newBlock(0)
require.NoError(t, err)
Expand Down
14 changes: 7 additions & 7 deletions services/requester/requester.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (
"strings"

"github.com/onflow/cadence"
"github.com/onflow/flow-evm-gateway/api/errors"
"github.com/onflow/flow-evm-gateway/config"
"github.com/onflow/flow-go-sdk"
"github.com/onflow/flow-go-sdk/access"
"github.com/onflow/flow-go-sdk/crypto"
Expand All @@ -24,6 +22,9 @@ import (
gethVM "github.com/onflow/go-ethereum/core/vm"
"github.com/rs/zerolog"
"golang.org/x/sync/errgroup"

"github.com/onflow/flow-evm-gateway/api/errors"
"github.com/onflow/flow-evm-gateway/config"
)

var (
Expand Down Expand Up @@ -283,7 +284,7 @@ func (e *EVM) GetBalance(
e.logger.Panic().Msg(fmt.Sprintf("failed to convert balance %v to UInt", val))
}

return val.(cadence.UInt).ToGoValue().(*big.Int), nil
return val.(cadence.UInt).Big(), nil
}

func (e *EVM) GetNonce(
Expand Down Expand Up @@ -313,7 +314,7 @@ func (e *EVM) GetNonce(
e.logger.Panic().Msg(fmt.Sprintf("failed to convert balance %v to UInt64", val))
}

return val.(cadence.UInt64).ToGoValue().(uint64), nil
return uint64(val.(cadence.UInt64)), nil
}

func (e *EVM) Call(
Expand Down Expand Up @@ -458,7 +459,7 @@ func (e *EVM) GetLatestEVMHeight(ctx context.Context) (uint64, error) {
e.logger.Panic().Msg(fmt.Sprintf("failed to convert height %v to UInt64", val))
}

return val.(cadence.UInt64).ToGoValue().(uint64), nil
return uint64(val.(cadence.UInt64)), nil
}

// getSignerNetworkInfo loads the signer account from network and returns key index and sequence number
Expand Down Expand Up @@ -537,8 +538,7 @@ func cadenceStringToBytes(value cadence.Value) ([]byte, error) {
return nil, fmt.Errorf("failed to convert cadence value to string: %v", value)
}

hexEncodedCode := cdcString.ToGoValue().(string)
code, err := hex.DecodeString(hexEncodedCode)
code, err := hex.DecodeString(string(cdcString))
if err != nil {
return nil, fmt.Errorf("failed to decode string to byte array: %w", err)
}
Expand Down
14 changes: 7 additions & 7 deletions tests/go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module github.com/onflow/flow-evm-gateway/integration

go 1.21
go 1.20

require (
github.com/goccy/go-json v0.10.2
github.com/onflow/cadence v1.0.0-preview.23
github.com/onflow/flow-emulator v1.0.0-preview.21
github.com/onflow/cadence v1.0.0-preview.25
github.com/onflow/flow-emulator v1.0.0-preview.22
github.com/onflow/flow-evm-gateway v0.0.0-20240201154855-4d4d3d3f19c7
github.com/onflow/flow-go v0.34.0-crescendo-preview.17
github.com/onflow/flow-go-sdk v1.0.0-preview.22
github.com/onflow/flow-go v0.34.0-crescendo-preview.18
github.com/onflow/flow-go-sdk v1.0.0-preview.25
github.com/onflow/go-ethereum v1.13.4
github.com/rs/zerolog v1.31.0
github.com/stretchr/testify v1.9.0
Expand Down Expand Up @@ -88,7 +88,7 @@ require (
github.com/improbable-eng/grpc-web v0.15.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/ipfs/bbloom v0.0.4 // indirect
github.com/ipfs/boxo v0.19.0 // indirect
github.com/ipfs/boxo v0.17.1-0.20240131173518-89bceff34bf1 // indirect
github.com/ipfs/go-block-format v0.2.0 // indirect
github.com/ipfs/go-cid v0.4.1 // indirect
github.com/ipfs/go-datastore v0.6.0 // indirect
Expand Down Expand Up @@ -129,7 +129,7 @@ require (
github.com/multiformats/go-multistream v0.5.0 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/onflow/atree v0.6.1-0.20240416233652-f4568c0c03df // indirect
github.com/onflow/atree v0.7.0-rc.1 // indirect
github.com/onflow/crypto v0.25.1 // indirect
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240429192223-e696a8e439b5 // indirect
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240429192223-e696a8e439b5 // indirect
Expand Down
Loading

0 comments on commit a969fbb

Please sign in to comment.