Update docs

This commit is contained in:
github-actions
2023-07-27 20:32:02 +00:00
parent 20da070199
commit bb109bc064
4 changed files with 26 additions and 5 deletions

View File

@ -12,7 +12,7 @@ const ContextMockCaller = artifacts.require('ContextMockCaller');
const { shouldBehaveLikeRegularContext } = require('../utils/Context.behavior');
contract('ERC2771Context', function (accounts) {
const [, anotherAccount] = accounts;
const [, trustedForwarder] = accounts;
beforeEach(async function () {
this.forwarder = await MinimalForwarder.new();
@ -78,11 +78,11 @@ contract('ERC2771Context', function (accounts) {
it('returns the original sender when calldata length is less than 20 bytes (address length)', async function () {
// The forwarder doesn't produce calls with calldata length less than 20 bytes
const recipient = await ERC2771ContextMock.new(anotherAccount);
const recipient = await ERC2771ContextMock.new(trustedForwarder);
const { receipt } = await recipient.msgSender({ from: anotherAccount });
const { receipt } = await recipient.msgSender({ from: trustedForwarder });
await expectEvent(receipt, 'Sender', { sender: anotherAccount });
await expectEvent(receipt, 'Sender', { sender: trustedForwarder });
});
});
@ -108,5 +108,15 @@ contract('ERC2771Context', function (accounts) {
await expectEvent.inTransaction(tx, ERC2771ContextMock, 'Data', { data, integerValue, stringValue });
});
});
it('returns the full original data when calldata length is less than 20 bytes (address length)', async function () {
// The forwarder doesn't produce calls with calldata length less than 20 bytes
const recipient = await ERC2771ContextMock.new(trustedForwarder);
const { receipt } = await recipient.msgDataShort({ from: trustedForwarder });
const data = recipient.contract.methods.msgDataShort().encodeABI();
await expectEvent(receipt, 'DataShort', { data });
});
});
});