Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jahabeebs committed Nov 29, 2024
1 parent e60c117 commit f6e666c
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions apps/agent/test/e2e/scenarios/01_happy_path/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,11 @@ describe.sequential("single agent", () => {
notifier,
);

// Instantiate ProtocolProvider with updated constructor parameters
const protocolProvider = new ProtocolProvider(
{
l1: {
chainId: PROTOCOL_L2_CHAIN_ID,
// Using the same RPC due to Anvil's arbitrum block number bug
urls: [PROTOCOL_L2_LOCAL_URL],
transactionReceiptConfirmations: 1,
timeout: 1_000,
Expand Down Expand Up @@ -468,7 +468,6 @@ describe.sequential("single agent", () => {
const initBlock = await anvilClient.getBlockNumber();
const currentEpoch = await protocolProvider.getCurrentEpoch();

// Define accessControl as required by the updated ProtocolProvider methods
const accessControl = {
user: "0x000000000000000000000000000000000000000" as Address,
data: "0x" as Address,
Expand Down Expand Up @@ -498,7 +497,7 @@ describe.sequential("single agent", () => {
PROTOCOL_L2_CHAIN_ID,
);

// A1 proposes a response RESP1(REQ1) with accessControl
// A1 proposes a response RESP1(REQ1)
await protocolProvider.proposeResponse(
requestCreatedEvent.args._request,
{
Expand Down Expand Up @@ -604,7 +603,7 @@ describe.sequential("single agent", () => {
data: "0x" as Address,
};

// Account2 disputes RESP1, creating DISP1 with accessControl
// Account2 disputes RESP1, creating DISP1
await protocolProviderAccount2.disputeResponse(
requestCreatedEvent.args._request,
badResponseProposedEvent.args._response,
Expand All @@ -614,18 +613,18 @@ describe.sequential("single agent", () => {
responseId: badResponseProposedEvent.args._responseId as ResponseId,
requestId: requestCreatedEvent.args._requestId as RequestId,
},
account2AccessControl, // Pass accessControl
account2AccessControl,
);

// A1 proposes a correct response RESP2 with accessControl
// A1 proposes a correct response RESP2
await protocolProvider.proposeResponse(
requestCreatedEvent.args._request,
{
proposer: accounts[0].account.address,
requestId: requestCreatedEvent.args._requestId as RequestId,
response: ProphetCodec.encodeResponse({ block: correctResponse }),
},
agentAccessControl, // Pass accessControl
agentAccessControl,
);

const correctResponseProposedEvent = await waitForEvent({
Expand Down Expand Up @@ -764,7 +763,7 @@ describe.sequential("single agent", () => {
notifier,
);

// Instantiate ProtocolProvider with updated constructor parameters
// Set up the protocol provider with account[0]
const protocolProvider = new ProtocolProvider(
{
l1: {
Expand Down Expand Up @@ -818,7 +817,6 @@ describe.sequential("single agent", () => {
const initBlock = await anvilClient.getBlockNumber();
const currentEpoch = await protocolProvider.getCurrentEpoch();

// Define accessControl as required by the updated ProtocolProvider methods
const accessControl = {
user: "0x000000000000000000000000000000000000000" as Address,
data: "0x" as Address,
Expand Down Expand Up @@ -848,7 +846,7 @@ describe.sequential("single agent", () => {
PROTOCOL_L2_CHAIN_ID,
);

// A1 proposes a response RESP1(REQ1) with accessControl
// A1 proposes a response RESP1(REQ1)
await protocolProvider.proposeResponse(
requestCreatedEvent.args._request,
{
Expand Down Expand Up @@ -885,7 +883,7 @@ describe.sequential("single agent", () => {
data: "0x" as Address,
};

// Account2 disputes RESP1, creating DISP1 with accessControl
// Account2 disputes RESP1, creating DISP1
await protocolProvider.disputeResponse(
requestCreatedEvent.args._request,
responseProposedEvent.args._response,
Expand Down Expand Up @@ -918,7 +916,7 @@ describe.sequential("single agent", () => {
throw new Error("ResponseDisputed event not found");
}

// Account2 pledges for DISP1 with accessControl
// Account2 pledges for DISP1
await protocolProvider.pledgeForDispute(requestCreatedEvent.args._request, {
disputer: account2.account.address,
proposer: accounts[0].account.address,
Expand Down Expand Up @@ -1039,7 +1037,7 @@ describe.sequential("single agent", () => {
await anvilClient.increaseTime({ seconds: timeToIncrease });
await anvilClient.mine({ blocks: 1 });

// A1 escalates the dispute with accessControl
// A1 escalates the dispute
await protocolProvider.escalateDispute(
requestCreatedEvent.args._request,
{
Expand All @@ -1053,7 +1051,7 @@ describe.sequential("single agent", () => {
responseId: responseDisputedEvent.args._responseId as ResponseId,
requestId: requestCreatedEvent.args._requestId as RequestId,
},
escalationAccessControl, // Pass accessControl
escalationAccessControl,
);

const disputeEscalatedEvent = await waitForEvent({
Expand Down Expand Up @@ -1136,7 +1134,7 @@ describe.sequential("single agent", () => {
notifier,
);

// Instantiate ProtocolProvider with updated constructor parameters
// Instantiate ProtocolProvider for Account1
const protocolProvider = new ProtocolProvider(
{
l1: {
Expand Down Expand Up @@ -1217,7 +1215,7 @@ describe.sequential("single agent", () => {
throw new Error("RequestCreated event not found");
}

// Agent A1 proposes a response RESP1(REQ1) with accessControl
// Agent A1 proposes a response RESP1(REQ1)
const correctResponseBlock = await blockNumberService.getEpochBlockNumber(
currentEpoch.startTimestamp,
PROTOCOL_L2_CHAIN_ID,
Expand Down Expand Up @@ -1261,7 +1259,7 @@ describe.sequential("single agent", () => {
data: "0x",
};

// Account2 disputes RESP1, creating DISP1 with accessControl
// Account2 disputes RESP1, creating DISP1
await protocolProvider.disputeResponse(
requestCreatedEvent.args._request,
responseProposedEvent.args._response,
Expand Down Expand Up @@ -1356,7 +1354,7 @@ describe.sequential("single agent", () => {
},
});

// Wait for A1 to pledge against DISP1 with accessControl
// Wait for A1 to pledge against DISP1
await protocolProvider.pledgeAgainstDispute(requestCreatedEvent.args._request, {
disputer: account2.account.address,
proposer: accounts[0].account.address,
Expand Down Expand Up @@ -1407,7 +1405,7 @@ describe.sequential("single agent", () => {
await anvilClient.increaseTime({ seconds: timeToIncrease });
await anvilClient.mine({ blocks: 1 });

// A1 escalates the dispute with accessControl
// A1 escalates the dispute
await protocolProvider.escalateDispute(
requestCreatedEvent.args._request,
{
Expand Down

0 comments on commit f6e666c

Please sign in to comment.