[Possible Action Required]: Update to Defender SDK Simulation Response Model

Dear Defender Users,

We are introducing an update to the Defender SDK that includes significant changes to the Simulation Response model. This update restructures the response format, introducing new fields and renaming or relocating existing ones.

Key Changes:

  1. Restructured Response Model:
    • A new summary object aggregates key metadata and simulation details, such as network, blockNumber, and cummulativeGasUsed.
    • A new records array provides detailed transaction-level information, including events, state changes, and revert reasons.
    • Most fields previously in meta have been moved to summary with updated names.

Old Structure:

export interface SimulationResponse {
  contractProposalId: string;
  createdAt: string;
  transaction: SimulationTransaction;
  meta: SimulationMetadata;
  states: ContractState[];
  events: LogEvent[];
  logs?: Log[];
  storage: StorageState[];
  traces: TransactionTrace[];
  transfers: TransactionTrace[];
}

export interface SimulationMetadata {
  network: string;
  blockNumber: number;
  forkedBlockNumber: number;
  simulatedBlockNumber: number;
  gasUsed: number;
  returnValue: string;
  returnString: string;
  reverted: boolean;
}

New Structure:

export interface SimulationResponse {
  summary: {
    network: string;
    blockNumber: number;
    totalCalls: number;
    cummulativeGasUsed: number;
    reverted: boolean;
    result?: string;
    revertReason?: string;
    events: IEvent[];
    contractStates: ContractState[];
    states: TraceRecordStateDiff[];
    transfers: TraceRecordTransaction[];
  };
  records: {
    index: number;
    transaction: TraceRecordTransaction;
    events?: IEvent[];
    states?: TraceRecordStateDiff[];
    status: {
      reverted: boolean;
      gasUsed: string;
      returnValue: string;
    };
    revertReason?: string;
  }[];
  contractProposalId: string;
  createdAt: string;
  error?: string;
}

These updates aim to enhance clarity and usability of simulation data. However, these changes may introduce breaking changes to any integrations relying on the previous structure.

What You Need to Do:

  • Review the updated response model to ensure compatibility with your applications.
  • Test your code with the latest SDK version which will be released some time next week.
  • Update your implementation accordingly.

For further details, please refer to the pull request #632.

If you have any questions or need assistance, feel free to contact us at defender-support@openzeppelin.com.

Thank you for using Defender!

Best regards,
The Defender Team