Skip to content

Commit

Permalink
Revert message address indexing. (#2002)
Browse files Browse the repository at this point in the history
* Revert message address indexing.

* Fix for indexed keyword being where it shouldn't.

* Fix for deployment.

---------

Co-authored-by: StefanIliev545 <[email protected]>
  • Loading branch information
StefanIliev545 and StefanIliev545 authored Aug 1, 2024
1 parent 65d9646 commit 7b62b2e
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const topic = hre.ethers.id(eventSignature)

// Get the interface for the event in order to convert it to cross chain message.
let eventIface = new hre.ethers.Interface([ `event LogMessagePublished(address indexed,uint64,uint32,uint32,bytes,uint8)`]);
let eventIface = new hre.ethers.Interface([ `event LogMessagePublished(address,uint64,uint32,uint32,bytes,uint8)`]);

// This function converts the logs from transaction receipts into cross chain messages
function getXChainMessages(result: Receipt) {
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/generated/EthereumBridge/EthereumBridge.go

Large diffs are not rendered by default.

Large diffs are not rendered by default.

28 changes: 9 additions & 19 deletions contracts/generated/MerkleTreeMessageBus/MerkleTreeMessageBus.go

Large diffs are not rendered by default.

28 changes: 9 additions & 19 deletions contracts/generated/MessageBus/MessageBus.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/generated/ObsERC20/ObsERC20.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/generated/ObscuroBridge/ObscuroBridge.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/generated/WrappedERC20/WrappedERC20.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/src/messaging/IMessageBus.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface IMessageBus {
// The enclave listens for it on the deployed message bus addresses.
event LogMessagePublished
(
address indexed sender,
address sender,
uint64 sequence,
uint32 nonce,
uint32 topic,
Expand Down
4 changes: 2 additions & 2 deletions contracts/test/bridge-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe("Bridge", function () {

const eventSignature = "LogMessagePublished(address,uint64,uint32,uint32,bytes,uint8)";
const topic = ethers.id(eventSignature)
let eventIface = new ethers.Interface([ `event LogMessagePublished(address indexed,uint64,uint32,uint32,bytes,uint8)`]);
let eventIface = new ethers.Interface([ `event LogMessagePublished(address,uint64,uint32,uint32,bytes,uint8)`]);

const receipt = (await tx.wait())!!;

Expand Down Expand Up @@ -283,7 +283,7 @@ describe("Bridge", function () {

await expect(event).to.not.be.undefined;

let eventIface = new ethers.Interface([ `event LogMessagePublished(address indexed,uint64,uint32,uint32,bytes,uint8)`]);
let eventIface = new ethers.Interface([ `event LogMessagePublished(address,uint64,uint32,uint32,bytes,uint8)`]);

const decodedEvent = eventIface.parseLog({
topics: event!.topics!.map((v)=>v),
Expand Down
5 changes: 0 additions & 5 deletions go/enclave/crosschain/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,11 @@ func convertLogsToMessages(logs []types.Log, eventName string, messageBusABI abi
messages := make(common.CrossChainMessages, 0)

for _, log := range logs {
if len(log.Topics) != 2 {
return nil, fmt.Errorf("invalid number of topics in log: %d", len(log.Topics))
}

var event MessageBus.MessageBusLogMessagePublished
err := messageBusABI.UnpackIntoInterface(&event, eventName, log.Data)
if err != nil {
return nil, err
}
event.Sender = gethcommon.BytesToAddress(log.Topics[1].Bytes())

msg := createCrossChainMessage(event)
messages = append(messages, msg)
Expand Down

0 comments on commit 7b62b2e

Please sign in to comment.