Skip to content

Commit

Permalink
Merge branch 'main' into fix-jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
d1onys1us committed May 8, 2024
2 parents 7d96d11 + fe49ed8 commit 7b5f0de
Show file tree
Hide file tree
Showing 11 changed files with 9,352 additions and 7,373 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/eventindexer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
go-version: 1.21.0
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
uses: golangci/golangci-lint-action@v6
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/guardianproverhealthcheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
go-version: 1.21.0
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
uses: golangci/golangci-lint-action@v6
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/relayer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
go-version: 1.21.0
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
uses: golangci/golangci-lint-action@v6
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,6 @@ __pycache__/
.vscode/launch.json
packages/protocol/config.js
.vercel

# Idea
.idea/
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,6 @@ require (

replace github.com/ethereum/go-ethereum v1.13.15 => github.com/taikoxyz/taiko-geth v0.0.0-20240504072040-7e1b8b65a3f8

replace github.com/ethereum-optimism/optimism v1.7.4 => github.com/taikoxyz/optimism v0.0.0-20240504104604-6c9729321b29
replace github.com/ethereum-optimism/optimism v1.7.4 => github.com/taikoxyz/optimism v0.0.0-20240508063202-db34e8c760ea

replace github.com/uber/jaeger-client-go => github.com/uber/jaeger-client-go v2.25.0+incompatible
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1119,8 +1119,8 @@ github.com/swaggo/swag v1.16.3/go.mod h1:DImHIuOFXKpMFAQjcC7FG4m3Dg4+QuUgUzJmKjI
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs=
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48=
github.com/taikoxyz/optimism v0.0.0-20240504104604-6c9729321b29 h1:JcOxHwY5zQfqsjx2Uh9WwWkcwy5jJX3XR2YQEx3IByY=
github.com/taikoxyz/optimism v0.0.0-20240504104604-6c9729321b29/go.mod h1:bkiRWtDE4T9nXmaK5NBKC/buX5GnyJ6VKozGFwiwKxs=
github.com/taikoxyz/optimism v0.0.0-20240508063202-db34e8c760ea h1:+oLT2sxS+KLgHZVW4toyKavAMbgjYkFOiL0YpciATnQ=
github.com/taikoxyz/optimism v0.0.0-20240508063202-db34e8c760ea/go.mod h1:bkiRWtDE4T9nXmaK5NBKC/buX5GnyJ6VKozGFwiwKxs=
github.com/taikoxyz/taiko-geth v0.0.0-20240504072040-7e1b8b65a3f8 h1:z4juQ4Nyp2T836JTCNC8t3vrbr0K9v2pPUV/ir2dy9s=
github.com/taikoxyz/taiko-geth v0.0.0-20240504072040-7e1b8b65a3f8/go.mod h1:nqByouVW0a0qx5KKgvYgoXba+pYEHznAAQp6LhZilgM=
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
Expand Down
2 changes: 1 addition & 1 deletion packages/bridge-ui/src/libs/connect/web3modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const web3modal = createWeb3Modal({
projectId,
featuredWalletIds: [],
allowUnsupportedChain: true,
excludeWalletIds: ['c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96'],
excludeWalletIds: [],
// chains,
chainImages,
themeVariables: {
Expand Down
8 changes: 4 additions & 4 deletions packages/taiko-client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ lint:
&& goimports -local "github.com/taikoxyz/taiko-mono/packages/taiko-client" -w ./ \
&& golangci-lint run

test:
PACKAGE=${PACKAGE} \
test: lint
@PACKAGE=${PACKAGE} \
RUN_TESTS=true \
./integration_test/entrypoint.sh

dev_net:
COMPILE_PROTOCOL=${COMPILE_PROTOCOL} \
@COMPILE_PROTOCOL=${COMPILE_PROTOCOL} \
./integration_test/entrypoint.sh

gen_bindings:
TAIKO_GETH_DIR=${TAIKO_GETH_DIR} \
@TAIKO_GETH_DIR=${TAIKO_GETH_DIR} \
./scripts/gen_bindings.sh

.PHONY: build \
Expand Down
2 changes: 1 addition & 1 deletion packages/taiko-client/bindings/.githead
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8532b7750513b87732340030139513d2b2ee203b
d4b62d23b4819bd932ad52b040a01f2cbbbeb9f2
Original file line number Diff line number Diff line change
Expand Up @@ -6,101 +6,86 @@ import (
"testing"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"

"github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/testutils"
"github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/utils"
"github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/rpc"
)

var (
maxBlocksGasLimit = uint64(50)
maxTxlistBytes = uint64(10000)
chainID = genesis.Config.ChainID
testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
testAddr = crypto.PubkeyToAddress(testKey.PublicKey)
genesis = &core.Genesis{
Config: params.AllEthashProtocolChanges,
Alloc: types.GenesisAlloc{testAddr: {Balance: big.NewInt(2e15)}},
ExtraData: []byte("test genesis"),
Timestamp: 9000,
BaseFee: big.NewInt(params.InitialBaseFee),
}
chainID = new(big.Int).SetUint64(167001)
testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
testAddr = crypto.PubkeyToAddress(testKey.PublicKey)
)

func TestDecomporess(t *testing.T) {
d := NewTxListDecompressor(
maxBlocksGasLimit,
maxTxlistBytes,
type TxListDecompressorTestSuite struct {
testutils.ClientTestSuite
d *TxListDecompressor
}

func (s *TxListDecompressorTestSuite) SetupTest() {
s.ClientTestSuite.SetupTest()
s.d = NewTxListDecompressor(
params.MaxGasLimit,
rpc.BlockMaxTxListBytes,
chainID,
)
}

func (s *TxListDecompressorTestSuite) TestZeroBytes() {
s.Empty(s.d.TryDecompress(chainID, []byte{}, false))
}

func (s *TxListDecompressorTestSuite) TestCalldataSize() {
s.Empty(s.d.TryDecompress(chainID, randBytes(rpc.BlockMaxTxListBytes+1), false))
s.Empty(s.d.TryDecompress(chainID, randBytes(rpc.BlockMaxTxListBytes-1), false))
}

func (s *TxListDecompressorTestSuite) TestValidTxList() {
compressed, err := utils.Compress(rlpEncodedTransactionBytes(1, true))
require.NoError(t, err)

tests := []struct {
name string
blockID *big.Int
txListBytes []byte
decompressed []byte
}{
{
"txListBytes binary too large",
chainID,
randBytes(maxTxlistBytes + 1),
[]byte{},
},
{
"txListBytes not decodable to rlp",
chainID,
randBytes(0x1),
[]byte{},
},
{
"success empty tx list",
chainID,
rlpEncodedTransactionBytes(0, true),
[]byte{},
},
{
"success non-empty tx list",
chainID,
compressed,
rlpEncodedTransactionBytes(1, true),
},
}
s.Nil(err)
decompressed, err := utils.Decompress(compressed)
s.Nil(err)

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
require.Equal(t, tt.decompressed, d.TryDecompress(tt.blockID, tt.txListBytes, false))
})
}
s.Equal(s.d.TryDecompress(chainID, compressed, true), decompressed)
s.Equal(s.d.TryDecompress(chainID, compressed, false), decompressed)
}

func (s *TxListDecompressorTestSuite) TestInvalidTxList() {
compressed, err := utils.Compress(randBytes(1024))
s.Nil(err)

s.Zero(len(s.d.TryDecompress(chainID, compressed, true)))
s.Zero(len(s.d.TryDecompress(chainID, compressed, false)))
}

func (s *TxListDecompressorTestSuite) TestInvalidZlibBytes() {
s.Zero(len(s.d.TryDecompress(chainID, randBytes(1024), true)))
s.Zero(len(s.d.TryDecompress(chainID, randBytes(1024), false)))
}

func TestDriverTestSuite(t *testing.T) {
suite.Run(t, new(TxListDecompressorTestSuite))
}

func rlpEncodedTransactionBytes(l int, signed bool) []byte {
txs := make(types.Transactions, 0)
for i := 0; i < l; i++ {
var tx *types.Transaction
if signed {
txData := &types.LegacyTx{
Nonce: 1,
To: &testAddr,
GasPrice: common.Big256,
Value: common.Big1,
Gas: 10,
}

tx = types.MustSignNewTx(testKey, types.LatestSigner(genesis.Config), txData)
txData := &types.LegacyTx{Nonce: 1, To: &testAddr, GasPrice: common.Big256, Value: common.Big1, Gas: 10}

tx = types.MustSignNewTx(testKey, types.LatestSigner(&params.ChainConfig{ChainID: chainID}), txData)
} else {
tx = types.NewTransaction(1, testAddr, common.Big1, 10, new(big.Int).SetUint64(10*params.GWei), nil)
}
txs = append(
txs,
tx,
)
txs = append(txs, tx)
}
b, _ := rlp.EncodeToBytes(txs)
return b
Expand Down
Loading

0 comments on commit 7b5f0de

Please sign in to comment.