Skip to content

Commit

Permalink
Merge branch 'main' into CedarMist/client-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
CedarMist authored Jun 17, 2024
2 parents d05539d + 398f116 commit 50f6290
Show file tree
Hide file tree
Showing 17 changed files with 897 additions and 616 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
with:
node-version: 18

- uses: pnpm/action-setup@v3
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- uses: pnpm/action-setup@v3
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
with:
node-version: 18

- uses: pnpm/action-setup@v3
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
# Always run this step so that all linting errors can be seen at once.
if: always()
- name: Lint Go
uses: golangci/golangci-lint-action@v5
uses: golangci/golangci-lint-action@v6
with:
version: v1.56.2
working-directory: ./clients/go
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/contracts-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 18
- uses: pnpm/action-setup@v3
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: "18"
- uses: pnpm/action-setup@v3
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
Expand Down
17 changes: 11 additions & 6 deletions clients/go/compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ var Networks = map[uint64]NetworkParams{
}

// PackTx prepares a regular Eth transaction for Sapphire. The transaction returned from this function is what must be signed.
func PackTx(tx types.Transaction, cipher Cipher) (*types.Transaction, error) {
if !txNeedsPacking(&tx) {
return &tx, nil
func PackTx(tx *types.Transaction, cipher Cipher) (*types.Transaction, error) {
if !txNeedsPacking(tx) {
return tx, nil
}
return packTx(tx, cipher)
}

func packTx(tx types.Transaction, cipher Cipher) (*types.Transaction, error) {
func packTx(tx *types.Transaction, cipher Cipher) (*types.Transaction, error) {
return types.NewTx(&types.LegacyTx{
Nonce: tx.Nonce(),
GasPrice: tx.GasPrice(),
Expand Down Expand Up @@ -94,7 +94,12 @@ func PackSignedCall(msg ethereum.CallMsg, cipher Cipher, sign SignerFn, chainID
if msg.GasPrice == nil {
msg.GasPrice = big.NewInt(DefaultGasPrice) // Must be non-zero for signed calls.
}
dataPack, err := evm.NewSignedCallDataPack(rsvSigner{sign}, chainID.Uint64(), msg.From[:], msg.To[:], msg.Gas, msg.GasPrice, msg.Value, msg.Data, *leash)
// msg.To is nil when deploying.
var to []byte
if msg.To != nil {
to = msg.To[:]
}
dataPack, err := evm.NewSignedCallDataPack(rsvSigner{sign}, chainID.Uint64(), msg.From[:], to, msg.Gas, msg.GasPrice, msg.Value, msg.Data, *leash)
if err != nil {
return nil, fmt.Errorf("failed to create signed call data back: %w", err)
}
Expand Down Expand Up @@ -173,7 +178,7 @@ func (b WrappedBackend) Transactor(from common.Address) *bind.TransactOpts {
if addr != from {
return nil, bind.ErrNotAuthorized
}
packedTx, err := PackTx(*tx, b.cipher)
packedTx, err := PackTx(tx, b.cipher)
if err != nil {
return nil, fmt.Errorf("failed to pack tx: %w", err)
}
Expand Down
37 changes: 19 additions & 18 deletions clients/go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ module github.com/oasisprotocol/sapphire-paratime/clients/go
go 1.22

require (
github.com/ethereum/go-ethereum v1.13.12
github.com/ethereum/go-ethereum v1.14.3
github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a
github.com/oasisprotocol/oasis-sdk/client-sdk/go v0.7.2
github.com/oasisprotocol/oasis-sdk/client-sdk/go v0.8.2
)

replace github.com/cometbft/cometbft => github.com/oasisprotocol/cometbft v0.37.2-oasis1
Expand All @@ -14,17 +14,18 @@ require (
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/a8m/envsubst v1.4.2 // indirect
github.com/bits-and-blooms/bitset v1.13.0 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cometbft/cometbft v0.0.0-00010101000000-000000000000 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect
github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
github.com/eapache/channels v1.1.0 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/ethereum/c-kzg-4844 v0.4.2 // indirect
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
Expand All @@ -40,22 +41,22 @@ require (
github.com/ipfs/go-log/v2 v2.5.1 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/libp2p/go-libp2p v0.30.0 // indirect
github.com/libp2p/go-libp2p v0.32.2 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.2.0 // indirect
github.com/multiformats/go-multiaddr v0.11.0 // indirect
github.com/multiformats/go-multiaddr v0.12.0 // indirect
github.com/multiformats/go-multibase v0.2.0 // indirect
github.com/multiformats/go-multicodec v0.9.0 // indirect
github.com/multiformats/go-multihash v0.2.3 // indirect
github.com/multiformats/go-multistream v0.4.1 // indirect
github.com/multiformats/go-multistream v0.5.0 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/oklog/run v1.0.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
Expand All @@ -68,18 +69,18 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.15.0 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/stretchr/testify v1.9.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/tidwall/btree v1.6.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.25.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.18.0 // indirect
golang.org/x/tools v0.20.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9 // indirect
google.golang.org/grpc v1.61.1 // indirect
google.golang.org/grpc/security/advancedtls v0.0.0-20221004221323-12db695f1648 // indirect
Expand All @@ -97,12 +98,12 @@ require (
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/fxamacker/cbor/v2 v2.4.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/oasisprotocol/deoxysii v0.0.0-20220228165953-2091330c22b7
github.com/oasisprotocol/oasis-core/go v0.2300.9
github.com/oasisprotocol/oasis-core/go v0.2300.10
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect
github.com/prometheus/common v0.44.0 // indirect
Expand All @@ -111,7 +112,7 @@ require (
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/x448/float16 v0.8.4 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/sys v0.19.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
)
Loading

0 comments on commit 50f6290

Please sign in to comment.