interop: fix ActiveFrom comparison when building HF-specific MD

These conditions are about filtering methods out. A method is excluded if its
ActiveFrom is strictly higher than the current HF, since if it's the same then
it should be present. Otherwise contract is broken at the height of this
particular HF.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
Roman Khimov 2024-11-23 17:20:20 +03:00
parent ff15e39363
commit 6b6878706a

View file

@ -294,7 +294,7 @@ func (c *ContractMD) buildHFSpecificMD(hf config.Hardfork) {
w := io.NewBufBinWriter()
for i := range c.methods {
m := c.methods[i]
if !(m.ActiveFrom == nil || (hf != config.HFDefault && (*m.ActiveFrom).Cmp(hf) >= 0)) ||
if (m.ActiveFrom != nil && (*m.ActiveFrom).Cmp(hf) > 0) ||
(m.ActiveTill != nil && (*m.ActiveTill).Cmp(hf) <= 0) {
continue
}
@ -317,7 +317,7 @@ func (c *ContractMD) buildHFSpecificMD(hf config.Hardfork) {
}
for i := range c.events {
e := c.events[i]
if !(e.ActiveFrom == nil || (hf != config.HFDefault && (*e.ActiveFrom).Cmp(hf) >= 0)) ||
if (e.ActiveFrom != nil && (*e.ActiveFrom).Cmp(hf) > 0) ||
(e.ActiveTill != nil && (*e.ActiveTill).Cmp(hf) <= 0) {
continue
}