Skip to content

Commit

Permalink
fix: missing hash/equals implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
delehef committed Dec 6, 2023
1 parent 4b44b3c commit 0f2c32a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

package net.consensys.linea.zktracer.bytestheta;

import java.util.Objects;

import net.consensys.linea.zktracer.types.Bytes16;
import org.apache.tuweni.bytes.Bytes32;
import org.apache.tuweni.bytes.MutableBytes32;
Expand Down Expand Up @@ -50,6 +52,19 @@ protected BaseBytes(final Bytes32 arg) {
bytes32 = arg.mutableCopy();
}

@Override
public int hashCode() {
return Objects.hash(this.bytes32);
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final BaseBytes that = (BaseBytes) o;
return Objects.equals(this.bytes32, that.bytes32);
}

/**
* Returns a new `Bytes16` object that is the high section (first 16 bytes) of the bytes32`
* instance variable.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final ExtOperation that = (ExtOperation) o;
return Objects.equals(opCode, that.opCode)
&& Objects.equals(arg1, that.arg1)
&& Objects.equals(arg2, that.arg2)
&& Objects.equals(arg3, that.arg3);
return Objects.equals(this.opCode, that.opCode)
&& Objects.equals(this.arg1, that.arg1)
&& Objects.equals(this.arg2, that.arg2)
&& Objects.equals(this.arg3, that.arg3);
}

public ExtOperation(OpCode opCode, Bytes32 arg1, Bytes32 arg2, Bytes32 arg3) {
Expand Down

0 comments on commit 0f2c32a

Please sign in to comment.