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

L1 events filtering for enclave submission #2174

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
lint
  • Loading branch information
badgersrus committed Dec 10, 2024
commit 9eec9f0f8e65463b01f5306918ce2df0c3e8885a
5 changes: 3 additions & 2 deletions go/common/l1_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package common
import (
"crypto/ecdsa"
"fmt"
"math/big"

gethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto/kzg4844"
"math/big"
)

// TenTransaction is an abstraction that transforms an Ethereum transaction into a format that can be consumed more
Expand Down Expand Up @@ -107,7 +108,7 @@ type L1TxData struct {
Transaction *types.Transaction
Receipt *types.Receipt
Blobs []*kzg4844.Blob // Only populated for blob transactions
//SequencerEnclaveID *EnclaveID // Only populated when a new enclave is added as a sequencer
// SequencerEnclaveID *EnclaveID // Only populated when a new enclave is added as a sequencer
CrossChainMessages *CrossChainMessages // Only populated for xchain messages
ValueTransfers *ValueTransferEvents // Only populated for xchain transfers
Proof []byte // Some merkle proof TBC
Expand Down
2 changes: 1 addition & 1 deletion go/config/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,6 @@ func load(filePaths []string) (*TenConfig, error) {
}

fmt.Println("Successfully loaded Ten config.")
//tenCfg.PrettyPrint()
tenCfg.PrettyPrint()
return &tenCfg, nil
}
6 changes: 3 additions & 3 deletions go/host/l1/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,9 @@ func (p *Publisher) PublishCrossChainBundle(bundle *common.ExtCrossChainBundle,

transactor.Nonce = big.NewInt(0).SetUint64(nonce)

//println("PublishCrossChainBundle L1 block num: ", bundle.L1BlockNum.Uint64())
//println("PublishCrossChainBundle rollupNum: ", rollupNum.Uint64())
//println("PublishCrossChainBundle nonce: ", nonce)
// println("PublishCrossChainBundle L1 block num: ", bundle.L1BlockNum.Uint64())
// println("PublishCrossChainBundle rollupNum: ", rollupNum.Uint64())
// println("PublishCrossChainBundle nonce: ", nonce)

tx, err := managementCtr.AddCrossChainMessagesRoot(transactor, [32]byte(bundle.LastBatchHash.Bytes()), bundle.L1BlockHash, bundle.L1BlockNum, bundle.CrossChainRootHashes, bundle.Signature, rollupNum, forkID)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion go/node/docker_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func NewDockerNode(cfg *config.TenConfig, hostImage, enclaveImage, edgelessDBIma

func (d *DockerNode) Start() error {
// todo (@pedro) - this should probably be removed in the future
//d.cfg.PrettyPrint() // dump config to stdout
// d.cfg.PrettyPrint() // dump config to stdout

err := d.startEdgelessDB()
if err != nil {
Expand Down
6 changes: 5 additions & 1 deletion integration/simulation/devnetwork/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,12 @@ func (n *InMemNodeOperator) createHostContainer() *hostcontainer.HostContainer {
}
rpcServer := node.NewServer(&rpcConfig, n.logger)
mgmtContractLib := mgmtcontractlib.NewMgmtContractLib(&hostConfig.ManagementContractAddress, n.logger)
l1Repo := l1.NewL1Repository(n.l1Client, []gethcommon.Address{hostConfig.ManagementContractAddress, hostConfig.MessageBusAddress}, n.logger)
contractAddresses := map[l1.ContractType][]gethcommon.Address{
l1.MgmtContract: {hostConfig.ManagementContractAddress},
l1.MsgBus: {hostConfig.MessageBusAddress},
}
blobResolver := l1.NewBlobResolver(ethadapter.NewL1BeaconClient(ethadapter.NewBeaconHTTPClient(new(http.Client), fmt.Sprintf("127.0.0.1:%d", n.config.L1BeaconPort))))
l1Repo := l1.NewL1Repository(n.l1Client, n.logger, mgmtContractLib, blobResolver, contractAddresses)
return hostcontainer.NewHostContainer(hostConfig, svcLocator, nodeP2p, n.l1Client, l1Repo, enclaveClients, mgmtContractLib, n.l1Wallet, rpcServer, hostLogger, metrics.New(false, 0, n.logger), blobResolver)
}

Expand Down
26 changes: 13 additions & 13 deletions integration/smartcontract/smartcontracts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func nonAttestedNodesCannotCreateRollup(t *testing.T, mgmtContractLib *debugMgmt
if err != nil {
t.Error(err)
}
txData, err := mgmtContractLib.CreateBlobRollup(&ethadapter.L1RollupTx{Rollup: encodedRollup})
txData, err := mgmtContractLib.CreateBlobRollup(&common.L1RollupTx{Rollup: encodedRollup})
if err != nil {
t.Error(err)
}
Expand All @@ -170,7 +170,7 @@ func nonAttestedNodesCannotCreateRollup(t *testing.T, mgmtContractLib *debugMgmt
func secretCannotBeInitializedTwice(t *testing.T, mgmtContractLib *debugMgmtContractLib, w *debugWallet, client ethadapter.EthClient) {
aggregatorID := datagenerator.RandomAddress()
txData := mgmtContractLib.CreateInitializeSecret(
&ethadapter.L1InitializeSecretTx{
&common.L1InitializeSecretTx{
EnclaveID: &aggregatorID,
},
)
Expand All @@ -196,7 +196,7 @@ func secretCannotBeInitializedTwice(t *testing.T, mgmtContractLib *debugMgmtCont
// do the same again
aggregatorID = datagenerator.RandomAddress()
txData = mgmtContractLib.CreateInitializeSecret(
&ethadapter.L1InitializeSecretTx{
&common.L1InitializeSecretTx{
EnclaveID: &aggregatorID,
},
)
Expand Down Expand Up @@ -225,7 +225,7 @@ func attestedNodesCreateRollup(t *testing.T, mgmtContractLib *debugMgmtContractL

// the aggregator starts the network
txData := mgmtContractLib.CreateInitializeSecret(
&ethadapter.L1InitializeSecretTx{
&common.L1InitializeSecretTx{
EnclaveID: &enclaveID,
},
)
Expand Down Expand Up @@ -256,7 +256,7 @@ func nonAttestedNodesCannotAttest(t *testing.T, mgmtContractLib *debugMgmtContra

// aggregator A starts the network secret
txData := mgmtContractLib.CreateInitializeSecret(
&ethadapter.L1InitializeSecretTx{
&common.L1InitializeSecretTx{
EnclaveID: &aggAID,
},
)
Expand All @@ -277,7 +277,7 @@ func nonAttestedNodesCannotAttest(t *testing.T, mgmtContractLib *debugMgmtContra
aggBID := crypto.PubkeyToAddress(aggBPrivateKey.PublicKey)

txData = mgmtContractLib.CreateRequestSecret(
&ethadapter.L1RequestSecretTx{
&common.L1RequestSecretTx{
Attestation: datagenerator.RandomBytes(10),
},
)
Expand All @@ -300,7 +300,7 @@ func nonAttestedNodesCannotAttest(t *testing.T, mgmtContractLib *debugMgmtContra
fakeSecret := []byte{123}

txData = mgmtContractLib.CreateRespondSecret(
(&ethadapter.L1RespondSecretTx{
(&common.L1RespondSecretTx{
AttesterID: aggCID,
RequesterID: aggBID,
Secret: fakeSecret,
Expand All @@ -315,7 +315,7 @@ func nonAttestedNodesCannotAttest(t *testing.T, mgmtContractLib *debugMgmtContra

// agg c responds to the secret AGAIN, but trying to mimick aggregator A
txData = mgmtContractLib.CreateRespondSecret(
(&ethadapter.L1RespondSecretTx{
(&common.L1RespondSecretTx{
Secret: fakeSecret,
RequesterID: aggBID,
AttesterID: aggAID,
Expand All @@ -341,7 +341,7 @@ func newlyAttestedNodesCanAttest(t *testing.T, mgmtContractLib *debugMgmtContrac

// the aggregator starts the network
txData := mgmtContractLib.CreateInitializeSecret(
&ethadapter.L1InitializeSecretTx{
&common.L1InitializeSecretTx{
EnclaveID: &aggAID,
InitialSecret: secretBytes,
},
Expand Down Expand Up @@ -370,7 +370,7 @@ func newlyAttestedNodesCanAttest(t *testing.T, mgmtContractLib *debugMgmtContrac
aggBID := crypto.PubkeyToAddress(aggBPrivateKey.PublicKey)

txData = mgmtContractLib.CreateRequestSecret(
&ethadapter.L1RequestSecretTx{
&common.L1RequestSecretTx{
Attestation: datagenerator.RandomBytes(10),
},
)
Expand All @@ -390,7 +390,7 @@ func newlyAttestedNodesCanAttest(t *testing.T, mgmtContractLib *debugMgmtContrac
aggCID := crypto.PubkeyToAddress(aggCPrivateKey.PublicKey)

txData = mgmtContractLib.CreateRequestSecret(
&ethadapter.L1RequestSecretTx{
&common.L1RequestSecretTx{
Attestation: datagenerator.RandomBytes(10),
},
)
Expand All @@ -405,7 +405,7 @@ func newlyAttestedNodesCanAttest(t *testing.T, mgmtContractLib *debugMgmtContrac

// Agg A responds to Agg C request
txData = mgmtContractLib.CreateRespondSecret(
(&ethadapter.L1RespondSecretTx{
(&common.L1RespondSecretTx{
Secret: secretBytes,
RequesterID: aggCID,
AttesterID: aggAID,
Expand All @@ -432,7 +432,7 @@ func newlyAttestedNodesCanAttest(t *testing.T, mgmtContractLib *debugMgmtContrac

// agg C attests agg B
txData = mgmtContractLib.CreateRespondSecret(
(&ethadapter.L1RespondSecretTx{
(&common.L1RespondSecretTx{
Secret: secretBytes,
RequesterID: aggBID,
AttesterID: aggCID,
Expand Down
Loading