FATE vs. AEVM (abiVersion & vmVersion)

in our Java SDK we want to hide the complexity for devs regarding this topic and I have a question regarding the combination of the abiVersion & vmVersion which is needed to provide when performing contract-related transactions.

for Lima the values to be used are as follows:

  • FATE (abiVersion=3, vmVersion=5)
  • AEVM (abiVersion=1, vmVersion=6)

I know there is some documentation on github protocol/contract_transactions.md at master · aeternity/protocol · GitHub

my question is:

  • is the abiVersion always the same? will it always be 3 for FATE and 1 for AEVM?

I created this enum to hide the complexity and if there will be new vmVersions for FATE or AEVM I would just change the vmVersion there and make a new release of the SDK. do you think that is ok?

/**
 * aeternity supports multiple virtual machines. depending on the selected VM contract related
 * transactions need to specify the respective abiVersion and vmVersion
 */
@AllArgsConstructor
public enum VirtualMachine {
  AEVM(BigInteger.ONE, BigInteger.valueOf(6), CompileOpts.BackendEnum.AEVM),
  FATE(BigInteger.valueOf(3), BigInteger.valueOf(5), CompileOpts.BackendEnum.FATE);

  @Getter private BigInteger abiVersion;
  @Getter private BigInteger vmVersion;
  @Getter private CompileOpts.BackendEnum backendEnum;

  public static VirtualMachine getVirtualMachine(BigInteger abiVersion) {
    if (AEVM.getAbiVersion().equals(abiVersion)) {
      return AEVM;
    }
    return FATE;
  }
}
1 Like

The ABI-version is not expected to change. The VM-version is normally incremented for each hard-fork (unless there are no consensus breaking changes in the VM).

3 Likes