Skip to content

Commit

Permalink
in mem passing
Browse files Browse the repository at this point in the history
  • Loading branch information
badgersrus committed Dec 19, 2024
1 parent 83d3819 commit 842945a
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 28 deletions.
27 changes: 11 additions & 16 deletions go/enclave/crosschain/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,17 @@ import (
)

var (
MessageBusABI, _ = abi.JSON(strings.NewReader(MessageBus.MessageBusMetaData.ABI))
MgmtContractABI, _ = abi.JSON(strings.NewReader(ManagementContract.ManagementContractMetaData.ABI))
CrossChainEventName = "LogMessagePublished"
CrossChainEventID = MessageBusABI.Events[CrossChainEventName].ID
ValueTransferEventName = "ValueTransfer"
ValueTransferEventID = MessageBusABI.Events["ValueTransfer"].ID
SequencerEnclaveGrantedEventName = "SequencerEnclaveGranted"
SequencerEnclaveGrantedEventID = MgmtContractABI.Events["SequencerEnclaveGranted"].ID
NetworkSecretRequestedName = "NetworkSecretRequested"
NetworkSecretRequestedID = MgmtContractABI.Events["NetworkSecretRequested"].ID
NetworkSecretRespondedName = "NetworkSecretResponded"
NetworkSecretRespondedID = MgmtContractABI.Events["NetworkSecretResponded"].ID
RollupAddedName = "RollupAdded"
RollupAddedID = MgmtContractABI.Events["RollupAdded"].ID
ImportantContractAddressUpdatedName = "ImportantContractAddressUpdated"
ImportantContractAddressUpdatedID = MgmtContractABI.Events["ImportantContractAddressUpdated"].ID
MessageBusABI, _ = abi.JSON(strings.NewReader(MessageBus.MessageBusMetaData.ABI))
MgmtContractABI, _ = abi.JSON(strings.NewReader(ManagementContract.ManagementContractMetaData.ABI))
CrossChainEventName = "LogMessagePublished"
CrossChainEventID = MessageBusABI.Events[CrossChainEventName].ID
ValueTransferEventName = "ValueTransfer"
ValueTransferEventID = MessageBusABI.Events["ValueTransfer"].ID
SequencerEnclaveGrantedEventID = MgmtContractABI.Events["SequencerEnclaveGranted"].ID
NetworkSecretRequestedID = MgmtContractABI.Events["NetworkSecretRequested"].ID
NetworkSecretRespondedID = MgmtContractABI.Events["NetworkSecretResponded"].ID
RollupAddedID = MgmtContractABI.Events["RollupAdded"].ID
ImportantContractAddressUpdatedID = MgmtContractABI.Events["ImportantContractAddressUpdated"].ID
)

func lazilyLogReceiptChecksum(block *types.Header, receipts types.Receipts, logger gethlog.Logger) {
Expand Down
3 changes: 0 additions & 3 deletions go/ethadapter/mgmtcontractlib/mgmt_contract_lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,6 @@ func (c *contractLibImpl) CreateBlobRollup(t *ethadapter.L1RollupTx) (types.TxDa
return nil, fmt.Errorf("failed to make sidecar: %w", err)
}

//for i, b := range blobHashes {
// println("MGMT CONTRACT creating blob with hashes ", b.Hex(), " at index: ", i)
//}
return &types.BlobTx{
To: *c.addr,
Data: data,
Expand Down
4 changes: 0 additions & 4 deletions go/host/enclave/guardian.go
Original file line number Diff line number Diff line change
Expand Up @@ -790,10 +790,6 @@ func (g *Guardian) calculateNonRolledupBatchesSize(seqNo uint64) (uint64, error)
currentNo++
}

if size > 131072 {
println("HERE")
}

return size, nil
}

Expand Down
1 change: 1 addition & 0 deletions go/host/l1/blockrepository.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ func (r *Repository) processManagementContractTx(txData *common.L1TxData, proces
processed.AddEvent(common.RollupTx, txData)
}
default:
// this might want to be an error since we should never see transactions we can't decode
r.logger.Warn("Unknown tx type", "txHash", txData.Transaction.Hash().Hex())
}
}
Expand Down
3 changes: 0 additions & 3 deletions integration/ethereummock/mgmt_contract_lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ func (m *mockContractLib) GetContractAddr() *gethcommon.Address {
func (m *mockContractLib) DecodeTx(tx *types.Transaction) ethadapter.L1Transaction {
// Do not decode erc20 transactions, this is the responsibility
// of the erc20 contract lib.
if tx.To() == nil {
println("HERE")
}
if tx.To().Hex() == depositTxAddr.Hex() {
return nil
}
Expand Down
19 changes: 17 additions & 2 deletions integration/ethereummock/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,21 @@ func (m *Node) TransactionReceipt(_ gethcommon.Hash) (*types.Receipt, error) {
}

func (m *Node) TransactionByHash(hash gethcommon.Hash) (*types.Transaction, bool, error) {
// First check if the transaction exists in any block
// First check mempool/pending transactions
select {
case tx := <-m.mempoolCh:
if tx.Hash() == hash {
// Put the tx back in the channel
m.mempoolCh <- tx
return tx, false, nil
}
// Put the tx back in the channel
m.mempoolCh <- tx
default:
// Don't block if mempool channel is empty
}

// Then check if the transaction exists in any block
blk, err := m.BlockResolver.FetchHeadBlock(context.Background())
if err != nil {
return nil, false, fmt.Errorf("could not retrieve head block. Cause: %w", err)
Expand All @@ -174,7 +188,8 @@ func (m *Node) TransactionByHash(hash gethcommon.Hash) (*types.Transaction, bool
}
}

return nil, false, nil
// If we get here, the transaction wasn't found
return nil, false, ethereum.NotFound
}

func (m *Node) Nonce(gethcommon.Address) (uint64, error) {
Expand Down

0 comments on commit 842945a

Please sign in to comment.