From fb10111b971ee0cf3b7a2be55b30391ee7824f5f Mon Sep 17 00:00:00 2001 From: echo Date: Mon, 13 Nov 2023 14:48:15 +0800 Subject: [PATCH] add auth to ormp mock --- test/ORMP.m.sol | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/ORMP.m.sol b/test/ORMP.m.sol index 5b948a2..00a1c43 100644 --- a/test/ORMP.m.sol +++ b/test/ORMP.m.sol @@ -22,8 +22,9 @@ import "../src/Verifier.sol"; contract ORMPMock is Verifier { ORMP ormp; - address oracle = 0x0000000000ba03146Cc235509E802873D418a6bc; + address immutable caller; address immutable self = address(this); + address constant oracle = 0x0000000000ba03146Cc235509E802873D418a6bc; struct P { Message message; @@ -31,6 +32,7 @@ contract ORMPMock is Verifier { } constructor() { + caller = msg.sender; ormp = new ORMP(self); ormp.setDefaultConfig(self, self); } @@ -53,6 +55,7 @@ contract ORMPMock is Verifier { } function dryrun_recv(bytes memory input) public { + require(caller == msg.sender, "!auth"); IVerifier(oracle).merkleRoot(46, 0); P memory p = abi.decode(input, (P)); ormp.recv(p.message, p.proof);