Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(contracts): Bump to use [email protected] #68

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions cmd/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func main() {
ctx := context.Background()

/* EigenDA dependency contracts */
daRollupManagerString := flag.String("daRollupManager", "0x0000000000000000000000000000000000000000", "the address of the eigenda rollup manager contract")

l1conn := flag.String("l1conn", "", "l1 connection")
l1keystore := flag.String("l1keystore", "", "l1 private key store")
Expand Down Expand Up @@ -182,7 +181,6 @@ func main() {
defer l1Reader.StopAndWait()

nativeToken := common.HexToAddress(*nativeTokenAddressString)
eigenDARollupManager := common.HexToAddress(*daRollupManagerString)

deployedAddresses, err := deploycode.DeployOnParentChain(
ctx,
Expand All @@ -194,7 +192,6 @@ func main() {
arbnode.GenerateRollupConfig(*prod, moduleRoot, ownerAddress, &chainConfig, chainConfigJson, loserEscrowAddress),
nativeToken,
maxDataSize,
eigenDARollupManager,
true,
)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion contracts
Submodule contracts updated 68 files
+2 −2 .github/workflows/audit-ci.yml
+1 −1 .github/workflows/base-branch-check.yml
+95 −90 .github/workflows/contract-tests.yml
+23 −21 .github/workflows/slither.yml
+1 −1 LICENSE.md
+3 −3 README.md
+1 −9 audit-ci.jsonc
+1 −1 foundry.toml
+0 −21 hardhat.config.ts
+1 −1 package.json
+2 −0 scripts/config.ts.example
+2 −1 scripts/deployment.ts
+11 −55 scripts/deploymentUtils.ts
+0 −106 scripts/local-deployment/createRollup.ts
+0 −57 scripts/local-deployment/deployBlobVerifierL1.ts
+0 −88 scripts/local-deployment/deployCreator.ts
+1 −1 scripts/local-deployment/deployCreatorAndCreateRollup.ts
+5 −5 scripts/rollupCreation.ts
+3 −3 src/bridge/AbsInbox.sol
+9 −0 src/bridge/ERC20Bridge.sol
+0 −40 src/bridge/EigenDABlobVerifierL1.sol
+0 −13 src/bridge/EigenDABlobVerifierL2.sol
+0 −12 src/bridge/IRollupManager.sol
+9 −11 src/bridge/ISequencerInbox.sol
+3 −0 src/bridge/Inbox.sol
+51 −16 src/bridge/SequencerInbox.sol
+18 −0 src/libraries/CallerChecker.sol
+3 −0 src/libraries/Error.sol
+2 −2 src/libraries/GasRefundEnabled.sol
+0 −18 src/mocks/ArbOS11To32UpgradeTest.sol
+2 −6 src/mocks/SequencerInboxStub.sol
+2 −2 src/osp/OneStepProverHostIo.sol
+7 −5 src/rollup/RollupCreator.sol
+1 −0 test/contract/arbRollup.spec.ts
+2 −0 test/e2e/orbitChain.ts
+10 −1 test/foundry/AbsInbox.t.sol
+1 −1 test/foundry/Bn254KZG.t.sol
+0 −67 test/foundry/EigenDABlobVerifierL1.t.sol
+1 −0 test/foundry/Inbox.t.sol
+11 −16 test/foundry/RollupCreator.t.sol
+132 −131 test/foundry/SequencerInbox.t.sol
+51 −25 test/signatures/Bridge
+21 −10 test/signatures/BridgeCreator
+45 −22 test/signatures/CacheManager
+43 −21 test/signatures/ChallengeManager
+33 −16 test/signatures/DeployHelper
+57 −27 test/signatures/ERC20Bridge
+45 −22 test/signatures/ERC20Inbox
+47 −23 test/signatures/ERC20Outbox
+61 −30 test/signatures/Inbox
+19 −9 test/signatures/OneStepProofEntry
+45 −22 test/signatures/Outbox
+151 −75 test/signatures/RollupAdminLogic
+91 −45 test/signatures/RollupCore
+39 −16 test/signatures/RollupCreator
+147 −73 test/signatures/RollupUserLogic
+87 −39 test/signatures/SequencerInbox
+1 −1 test/storage/Bridge
+1 −1 test/storage/CacheManager
+1 −1 test/storage/ERC20Bridge
+1 −1 test/storage/ERC20Inbox
+1 −1 test/storage/Inbox
+1 −1 test/storage/RollupAdminLogic
+1 −1 test/storage/RollupCore
+1 −1 test/storage/RollupUserLogic
+18 −7 test/storage/SequencerInbox
+1 −1 test/storage/test.bash
+17 −4 yarn.lock
18 changes: 6 additions & 12 deletions deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,21 +242,11 @@ func deployRollupCreator(ctx context.Context, parentChainReader *headerreader.He
return rollupCreator, rollupCreatorAddress, validatorUtils, validatorWalletCreator, nil
}

func DeployOnParentChain(ctx context.Context, parentChainReader *headerreader.HeaderReader, deployAuth *bind.TransactOpts, batchPosters []common.Address, batchPosterManager common.Address, authorizeValidators uint64, config rollupgen.Config, nativeToken common.Address, maxDataSize *big.Int, eigenDARollupManager common.Address, chainSupportsBlobs bool) (*chaininfo.RollupAddresses, error) {
func DeployOnParentChain(ctx context.Context, parentChainReader *headerreader.HeaderReader, deployAuth *bind.TransactOpts, batchPosters []common.Address, batchPosterManager common.Address, authorizeValidators uint64, config rollupgen.Config, nativeToken common.Address, maxDataSize *big.Int, chainSupportsBlobs bool) (*chaininfo.RollupAddresses, error) {
if config.WasmModuleRoot == (common.Hash{}) {
return nil, errors.New("no machine specified")
}

if eigenDARollupManager == (common.Address{0x0}) {
dummyRollupManager, tx, _, err := bridgegen.DeployEigenDABlobVerifierL2(deployAuth, parentChainReader.Client())
err = andTxSucceeded(ctx, parentChainReader, tx, err)
if err != nil {
return nil, fmt.Errorf("dummy manager deploy error: %w", err)
}

eigenDARollupManager = dummyRollupManager
}

rollupCreator, _, validatorUtils, validatorWalletCreator, err := deployRollupCreator(ctx, parentChainReader, deployAuth, maxDataSize, chainSupportsBlobs)
if err != nil {
return nil, fmt.Errorf("error deploying rollup creator: %w", err)
Expand All @@ -276,7 +266,11 @@ func DeployOnParentChain(ctx context.Context, parentChainReader *headerreader.He
MaxFeePerGasForRetryables: big.NewInt(0), // needed when utility factories are deployed
BatchPosters: batchPosters,
BatchPosterManager: batchPosterManager,
EigenDARollupManager: eigenDARollupManager,
// zero address indicates to the SequencerInbox that certificate verification should be disabled
// THIS creates an insecure testing environment for /system_tests
// testing a secure E2E Stage1 integration with EigenDA currently can only be done on
// a holesky testnet environment
EigenDACertVerifier: common.HexToAddress("0x0"),
}

tx, err := rollupCreator.CreateRollup(
Expand Down
213 changes: 108 additions & 105 deletions system_tests/arbos_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package arbtest
import (
"context"
"math/big"
"strings"
"testing"
"time"

Expand All @@ -17,7 +16,6 @@ import (
"github.com/offchainlabs/nitro/arbnode"
"github.com/offchainlabs/nitro/arbos/arbosState"
"github.com/offchainlabs/nitro/execution/gethexec"
"github.com/offchainlabs/nitro/solgen/go/mocksgen"
"github.com/offchainlabs/nitro/solgen/go/precompilesgen"
)

Expand Down Expand Up @@ -82,109 +80,114 @@ func checkArbOSVersion(t *testing.T, testClient *TestClient, expectedVersion uin

}

func TestArbos11To32UpgradeWithMcopy(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

initialVersion := uint64(11)
finalVersion := uint64(32)

builder := NewNodeBuilder(ctx).
DefaultConfig(t, true).
WithArbOSVersion(initialVersion)
cleanup := builder.Build(t)
defer cleanup()
seqTestClient := builder.L2

auth := builder.L2Info.GetDefaultTransactOpts("Owner", ctx)
auth.GasLimit = 32000000

// makes Owner a chain owner
arbDebug, err := precompilesgen.NewArbDebug(types.ArbDebugAddress, seqTestClient.Client)
Require(t, err)
tx, err := arbDebug.BecomeChainOwner(&auth)
Require(t, err)
_, err = EnsureTxSucceeded(ctx, seqTestClient.Client, tx)
Require(t, err)

// deploys test contract
_, tx, contract, err := mocksgen.DeployArbOS11To32UpgradeTest(&auth, seqTestClient.Client)
Require(t, err)
_, err = EnsureTxSucceeded(ctx, seqTestClient.Client, tx)
Require(t, err)

// build replica node
replicaConfig := arbnode.ConfigDefaultL1Test()
replicaConfig.BatchPoster.Enable = false
replicaTestClient, replicaCleanup := builder.Build2ndNode(t, &SecondNodeParams{nodeConfig: replicaConfig})
defer replicaCleanup()

checkArbOSVersion(t, seqTestClient, initialVersion, "initial sequencer")
checkArbOSVersion(t, replicaTestClient, initialVersion, "initial replica")

// mcopy should fail since arbos 11 doesn't support it
tx, err = contract.Mcopy(&auth)
Require(t, err)
_, err = seqTestClient.EnsureTxSucceeded(tx)
if (err == nil) || !strings.Contains(err.Error(), "invalid opcode: MCOPY") {
t.Errorf("expected MCOPY to fail, got %v", err)
}
_, err = WaitForTx(ctx, replicaTestClient.Client, tx.Hash(), time.Second*15)
Require(t, err)

// upgrade arbos to final version
arbOwner, err := precompilesgen.NewArbOwner(types.ArbOwnerAddress, seqTestClient.Client)
Require(t, err)
tx, err = arbOwner.ScheduleArbOSUpgrade(&auth, finalVersion, 0)
Require(t, err)
_, err = seqTestClient.EnsureTxSucceeded(tx)
Require(t, err)
_, err = WaitForTx(ctx, replicaTestClient.Client, tx.Hash(), time.Second*15)
Require(t, err)

// checks upgrade worked
tx, err = contract.Mcopy(&auth)
Require(t, err)
_, err = seqTestClient.EnsureTxSucceeded(tx)
Require(t, err)
_, err = WaitForTx(ctx, replicaTestClient.Client, tx.Hash(), time.Second*15)
Require(t, err)

checkArbOSVersion(t, seqTestClient, finalVersion, "final sequencer")
checkArbOSVersion(t, replicaTestClient, finalVersion, "final replica")

// generates more blocks
builder.L2Info.GenerateAccount("User2")
for i := 0; i < 3; i++ {
tx = builder.L2Info.PrepareTx("Owner", "User2", builder.L2Info.TransferGas, big.NewInt(1e12), nil)
err = seqTestClient.Client.SendTransaction(ctx, tx)
Require(t, err)
_, err = seqTestClient.EnsureTxSucceeded(tx)
Require(t, err)
_, err = WaitForTx(ctx, replicaTestClient.Client, tx.Hash(), time.Second*15)
Require(t, err)
}

blockNumberSeq, err := seqTestClient.Client.BlockNumber(ctx)
Require(t, err)
blockNumberReplica, err := replicaTestClient.Client.BlockNumber(ctx)
Require(t, err)
if blockNumberSeq != blockNumberReplica {
t.Errorf("expected sequencer and replica to have same block number, got %v and %v", blockNumberSeq, blockNumberReplica)
}
// #nosec G115
blockNumber := big.NewInt(int64(blockNumberSeq))

blockSeq, err := seqTestClient.Client.BlockByNumber(ctx, blockNumber)
Require(t, err)
blockReplica, err := replicaTestClient.Client.BlockByNumber(ctx, blockNumber)
Require(t, err)
if blockSeq.Hash() != blockReplica.Hash() {
t.Errorf("expected sequencer and replica to have same block hash, got %v and %v", blockSeq.Hash(), blockReplica.Hash())
}
}
// NOTE: Disabling this test shouldn't incur any consequences
// since it verifies upgradibility of nitro software from consensus v11
// to v32. EigenDA x Nitro only provides production guarantees for
// v32: https://github.com/Layr-Labs/nitro/releases/tag/consensus-eigenda-v32
//
// func TestArbos11To32UpgradeWithMcopy(t *testing.T) {
// t.Parallel()

// ctx, cancel := context.WithCancel(context.Background())
// defer cancel()

// initialVersion := uint64(11)
// finalVersion := uint64(32)

// builder := NewNodeBuilder(ctx).
// DefaultConfig(t, true).
// WithArbOSVersion(initialVersion)
// cleanup := builder.Build(t)
// defer cleanup()
// seqTestClient := builder.L2

// auth := builder.L2Info.GetDefaultTransactOpts("Owner", ctx)
// auth.GasLimit = 32000000

// // makes Owner a chain owner
// arbDebug, err := precompilesgen.NewArbDebug(types.ArbDebugAddress, seqTestClient.Client)
// Require(t, err)
// tx, err := arbDebug.BecomeChainOwner(&auth)
// Require(t, err)
// _, err = EnsureTxSucceeded(ctx, seqTestClient.Client, tx)
// Require(t, err)

// // deploys test contract
// _, tx, contract, err := mocksgen.DeployArbOS11To32UpgradeTest(&auth, seqTestClient.Client)
// Require(t, err)
// _, err = EnsureTxSucceeded(ctx, seqTestClient.Client, tx)
// Require(t, err)

// // build replica node
// replicaConfig := arbnode.ConfigDefaultL1Test()
// replicaConfig.BatchPoster.Enable = false
// replicaTestClient, replicaCleanup := builder.Build2ndNode(t, &SecondNodeParams{nodeConfig: replicaConfig})
// defer replicaCleanup()

// checkArbOSVersion(t, seqTestClient, initialVersion, "initial sequencer")
// checkArbOSVersion(t, replicaTestClient, initialVersion, "initial replica")

// // mcopy should fail since arbos 11 doesn't support it
// tx, err = contract.Mcopy(&auth)
// Require(t, err)
// _, err = seqTestClient.EnsureTxSucceeded(tx)
// if (err == nil) || !strings.Contains(err.Error(), "invalid opcode: MCOPY") {
// t.Errorf("expected MCOPY to fail, got %v", err)
// }
// _, err = WaitForTx(ctx, replicaTestClient.Client, tx.Hash(), time.Second*15)
// Require(t, err)

// // upgrade arbos to final version
// arbOwner, err := precompilesgen.NewArbOwner(types.ArbOwnerAddress, seqTestClient.Client)
// Require(t, err)
// tx, err = arbOwner.ScheduleArbOSUpgrade(&auth, finalVersion, 0)
// Require(t, err)
// _, err = seqTestClient.EnsureTxSucceeded(tx)
// Require(t, err)
// _, err = WaitForTx(ctx, replicaTestClient.Client, tx.Hash(), time.Second*15)
// Require(t, err)

// // checks upgrade worked
// tx, err = contract.Mcopy(&auth)
// Require(t, err)
// _, err = seqTestClient.EnsureTxSucceeded(tx)
// Require(t, err)
// _, err = WaitForTx(ctx, replicaTestClient.Client, tx.Hash(), time.Second*15)
// Require(t, err)

// checkArbOSVersion(t, seqTestClient, finalVersion, "final sequencer")
// checkArbOSVersion(t, replicaTestClient, finalVersion, "final replica")

// // generates more blocks
// builder.L2Info.GenerateAccount("User2")
// for i := 0; i < 3; i++ {
// tx = builder.L2Info.PrepareTx("Owner", "User2", builder.L2Info.TransferGas, big.NewInt(1e12), nil)
// err = seqTestClient.Client.SendTransaction(ctx, tx)
// Require(t, err)
// _, err = seqTestClient.EnsureTxSucceeded(tx)
// Require(t, err)
// _, err = WaitForTx(ctx, replicaTestClient.Client, tx.Hash(), time.Second*15)
// Require(t, err)
// }

// blockNumberSeq, err := seqTestClient.Client.BlockNumber(ctx)
// Require(t, err)
// blockNumberReplica, err := replicaTestClient.Client.BlockNumber(ctx)
// Require(t, err)
// if blockNumberSeq != blockNumberReplica {
// t.Errorf("expected sequencer and replica to have same block number, got %v and %v", blockNumberSeq, blockNumberReplica)
// }
// // #nosec G115
// blockNumber := big.NewInt(int64(blockNumberSeq))

// blockSeq, err := seqTestClient.Client.BlockByNumber(ctx, blockNumber)
// Require(t, err)
// blockReplica, err := replicaTestClient.Client.BlockByNumber(ctx, blockNumber)
// Require(t, err)
// if blockSeq.Hash() != blockReplica.Hash() {
// t.Errorf("expected sequencer and replica to have same block hash, got %v and %v", blockSeq.Hash(), blockReplica.Hash())
// }
// }

func TestArbos11To32UpgradeWithCalldata(t *testing.T) {
t.Parallel()
Expand Down
1 change: 0 additions & 1 deletion system_tests/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1401,7 +1401,6 @@ func deployOnParentChain(
arbnode.GenerateRollupConfig(prodConfirmPeriodBlocks, wasmModuleRoot, parentChainInfo.GetAddress("RollupOwner"), chainConfig, serializedChainConfig, common.Address{}),
nativeToken,
maxDataSize,
common.Address{0x0},
chainSupportsBlobs,
)
}
Expand Down
12 changes: 6 additions & 6 deletions system_tests/full_challenge_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,38 +212,38 @@ func makeBatchEigenDA(t *testing.T, l2Node *arbnode.Node, l2Info *BlockchainTest
blobInfo, err := eigenDA.Store(ctx, message)
Require(t, err)

bh := mocksgen.IEigenDAServiceManagerBatchHeader{
bh := mocksgen.BatchHeader{
BlobHeadersRoot: blobInfo.BlobVerificationProof.BatchMetadata.BatchHeader.BlobHeadersRoot,
QuorumNumbers: blobInfo.BlobVerificationProof.BatchMetadata.BatchHeader.QuorumNumbers,
SignedStakeForQuorums: blobInfo.BlobVerificationProof.BatchMetadata.BatchHeader.SignedStakeForQuorums,
ReferenceBlockNumber: blobInfo.BlobVerificationProof.BatchMetadata.BatchHeader.ReferenceBlockNumber,
}

bm := mocksgen.IEigenDAServiceManagerBatchMetadata{
bm := mocksgen.BatchMetadata{
BatchHeader: bh,
SignatoryRecordHash: blobInfo.BlobVerificationProof.BatchMetadata.SignatoryRecordHash,
ConfirmationBlockNumber: blobInfo.BlobVerificationProof.BatchMetadata.ConfirmationBlockNumber,
}

bvp := mocksgen.EigenDARollupUtilsBlobVerificationProof{
bvp := mocksgen.BlobVerificationProof{
BatchId: blobInfo.BlobVerificationProof.BatchID,
BlobIndex: blobInfo.BlobVerificationProof.BlobIndex,
BatchMetadata: bm,
InclusionProof: blobInfo.BlobVerificationProof.InclusionProof,
QuorumIndices: blobInfo.BlobVerificationProof.QuorumIndices,
}

solQps := make([]mocksgen.IEigenDAServiceManagerQuorumBlobParam, len(blobInfo.BlobHeader.QuorumBlobParams))
solQps := make([]mocksgen.QuorumBlobParam, len(blobInfo.BlobHeader.QuorumBlobParams))
for _, qp := range blobInfo.BlobHeader.QuorumBlobParams {
solQps = append(solQps, mocksgen.IEigenDAServiceManagerQuorumBlobParam{
solQps = append(solQps, mocksgen.QuorumBlobParam{
QuorumNumber: qp.QuorumNumber,
AdversaryThresholdPercentage: qp.AdversaryThresholdPercentage,
ConfirmationThresholdPercentage: qp.ConfirmationThresholdPercentage,
ChunkLength: qp.ChunkLength,
})
}

blobHeader := mocksgen.IEigenDAServiceManagerBlobHeader{
blobHeader := mocksgen.BlobHeader{
Commitment: mocksgen.BN254G1Point{
X: blobInfo.BlobHeader.Commitment.X,
Y: blobInfo.BlobHeader.Commitment.Y,
Expand Down
Loading